package day10;

/**
 * 功能手机只能打电话，发短信。
 * 后来智能机增加了上网，拍照，播放视频等功能。用oop的思想模拟。
 * 要求：抽象出手机父类，有品牌和型号属性。
 * 把上网，拍照等抽象成接口。
 *
 * 定义功能机(CommonHandSet)；
 * 智能机AptitudeHandSet,继承父类并实现相关接口
 */
public class Phone {
    private String type;
    private String model;
}
interface Net{
    void internet();
}
interface Photo{
    void takePhoto();
}
class CommonHandSet extends Phone{
    private String type;
    private String model;

    public CommonHandSet(String type, String model) {
        this.type = type;
        this.model = model;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }
    public void call(){
        System.out.println(type+"手机，型号是"+model+"可以打电话");
    }
    public void message(){
        System.out.println(type+"手机，型号是"+model+"可以发短信");
    }
}
class AptitudeHandSet extends Phone implements Net,Photo{
    private String type;
    private String model;

    public AptitudeHandSet(String type, String model) {
        this.type = type;
        this.model = model;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    @Override
    public void internet() {
        System.out.println(type+"智能手机，型号是"+model+"可以上网");
    }

    @Override
    public void takePhoto() {
        System.out.println(type+"智能手机，型号是"+model+"可以拍照");
    }
}
class Test2{
    public static void main(String[] args) {
        CommonHandSet a=new CommonHandSet("洛基亚","N97");
        a.message();a.call();
        Net b=new AptitudeHandSet("苹果","18PLUS");
        ((AptitudeHandSet) b).takePhoto();
        b.internet();
    }
}